import { requests } from './request'

export const getLogin = (data) => {
  return requests({
    url: '/login',
    method: 'post',
    data: data
  })
}

export const getRegister = (data) => {
  return requests({
    url: '/register',
    method: 'post',
    data: data
  })
}

export const getImgCode = () => {
  return requests({
    url: '/captchaImage',
    method: 'get',
  })
}


export const getLogout = (data) => {
  return requests({
    url: '/logout',
    method: 'post',
    data: data
  })
}

export const getUserInfo = () => {
  return requests({
    url: '/getInfo',
    method: 'get',
  })
}

export const getUserSubmit = (data) => {
  return requests({
    url: '/system/user/front/edit',
    method: 'put',
    data: data
  })
}


//=======================================================
export const reqArticleList = (data) => {
  return requests({
    url: '/system/article/front/list',
    method: 'get',
    params: data
  })
}

export const reqArticleCategoryList = (data) => {
  return requests({
    url: '/system/category/front/list',
    method: 'get',
    params: data
  })
}

export const reqNewNotice = (data) => {
  return requests({
    url: '/system/notice/front/new',
    method: 'get',
    params: data
  })
}

export const reqNoticeList = (data) => {
  return requests({
    url: '/system/notice/front/list',
    method: 'get',
    params: data
  })
}

export const getArticleInfo = (data) => {
  return requests({
    url: '/system/article/front/' + data,
    method: 'get',
  })
}

export const reqLikeRecordAdd = (data) => {
  return requests({
    url: '/system/record/front/add',
    method: 'post',
    data: data
  })
}

export const reqCollectAdd = (data) => {
  return requests({
    url: '/system/collect/front/add',
    method: 'post',
    data: data
  })
}

export const reqCollectList = (data) => {
  return requests({
    url: '/system/collect/front/list',
    method: 'get',
    params: data
  })
}

export const reqCollectDelete = (data) => {
  return requests({
    url: '/system/collect/front/delete/' + data.userId + '/' + data.articleId,
    method: 'delete',
  })
}

export const getCommentList = (data) => {
  return requests({
    url: '/system/comment/front/list',
    method: 'get',
    params: data
  })
}

export const getCommentSubmit = (data) => {
  return requests({
    url: '/system/comment/front/add',
    method: 'post',
    data: data
  })
}

export const getArticleDelete = (data) => {
  return requests({
    url: '/system/article/front/delete/' + data,
    method: 'delete',
  })
}

export const getArticleAdd = (data) => {
  return requests({
    url: '/system/article/front/add',
    method: 'post',
    data: data
  })
}

export const getArticleEdit = (data) => {
  return requests({
    url: '/system/article/front/edit',
    method: 'put',
    data: data
  })
}

export const reqFileShareList = (data) => {
  return requests({
    url: '/system/share/front/list',
    method: 'get',
    params: data
  })
}

export const reqFileShareAdd = (data) => {
  return requests({
    url: '/system/share/front/add',
    method: 'post',
    data: data
  })
}

export const reqFileShareDelete = (data) => {
  return requests({
    url: '/system/share/front/delete/' + data,
    method: 'delete',
  })
}


export const reqFileShareDownload = (data) => {
  return requests({
    url: '/system/share/front/download/' + data,
    method: 'post',
  })
}
